/**
 * Copyright 2011 Mathieu Magnaudet
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package edu.enac.geoapp.parser.pln;


/**
 * Simple bean encapsulating latitude and longitude for a point
 * @author mathieu
 */
public class MapPoint {

    /* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "MapPoint [id=" + id + ", latD=" + latD + ", latM=" + latM
				+ ", latDegreDecimaux=" + latDegreDecimaux + ", latS=" + latS + ", lonD=" + lonD
				+ ", lonM=" + lonM + ", lonDegreDecimaux=" + lonDegreDecimaux + ", lonS=" + lonS
				+ ", sensW=" + sensW + "]";
	}



	protected String id;
    private int latD;
    private int latM;
    private int latS;
    private int lonD;
    private int lonM;
    private int lonS;
    private boolean sensW;
    private float lonDegreDecimaux;
    private float latDegreDecimaux;

    /**
     * Constructor, builds a new map point
     * @param id
     * @param latD degree for latitude
     * @param latM minute for latitude
     * @param latS second for latitude
     * @param lonD degree for longitude
     * @param lonM minute for longitude
     * @param lonS second for longitude
     * @param sensW orientation
     */
	public MapPoint(String id, int latD, int latM, int latS, int lonD, int lonM, int lonS, boolean sensW) {
        this.id = id;
        this.latD = latD;
        this.latM = latM;
        this.latS = latS;
        this.lonD = lonD;
        this.lonM = lonM;
        this.lonS = lonS;
        this.sensW = sensW;
        this.latDegreDecimaux = getDegSexToDegDec(latD, latM, latS);
        this.lonDegreDecimaux = getDegSexToDegDec(lonD, lonM, lonS);

    }

    


	public void setId(String id) {
    	this.id = id;
    }
    
    public String getId() {
        return id;


    }

    public int getLatD() {
        return latD;


    }

    public int getLatM() {
        return latM;


    }

    public int getLatS() {
        return latS;


    }

    public int getLonD() {
        return lonD;


    }

    public int getLonM() {
        return lonM;


    }

    public int getLonS() {
        return lonS;


    }

    public boolean isSensW() {
        return sensW;


    }

    private  float getDegSexToDegDec(int deg, int min, int sec) {
        return (float) (deg + (float)min/60f + (float) sec / 3600f);


    }


    public float getLatDegDec() {
        return latDegreDecimaux;


    }

    public float getLonDegDec() {
        return lonDegreDecimaux;


    }

}
